package org.streets.workflow.engine.event;

import org.streets.workflow.engine.ITaskInstance;
import org.streets.workflow.engine.IWorkItem;


/**
 * 任务实例事件
 */
public class TaskEvent {
    /**
     * 在任务实例即将启动时触发的事件
     */
    public static final int BEFORE_TASK_INSTANCE_START = 2;
    
    /**
     * 当创建工作项之后
     */
    public static final int AFTER_WORKITEM_CREATED = 5;
    
    /**
     * 当工作项完成之后
     */
    public static final int AFTER_WORKITEM_COMPLETE = 6;
    
    /**
     * 在任务实例结束时触发的事件
     */
    public static final int AFTER_TASK_INSTANCE_COMPLETE = 7;
       
    
    private ITaskInstance source = null;
    
    private IWorkItem workItem = null;    
    
    private int eventType = -1;
    

    public TaskEvent() {
    	
    }


    /**
     * 返回事件类型，取值为BEFORE_TASK_INSTANCE_START或者AFTER_TASK_INSTANCE_COMPLETE
     * @return
     */
    public int getEventType() {
        return eventType;
    }

    public void setEventType(int eventType) {
        this.eventType = eventType;
    }

    /**
     * 返回触发该事件的任务实例
     * @return
     */
    public ITaskInstance getSource() {
        return source;
    }

    public void setSource(ITaskInstance source) {
        this.source = source;
    }

	public IWorkItem getWorkItem() {
		return workItem;
	}

	public void setWorkItem(IWorkItem workItem) {
		this.workItem = workItem;
	}
}
